// C1 E21
// Caution: pos from 0 or 1. pos=...-1 or not.
// Remember:when design a algrithm for circle, at least two circle to consider.

#include <stdio.h>

#define TAB 8

int main()
{
    int c;
    int nb, nt, pos;

    nb = nt = 0;
    pos = 1;

    while ((c = getchar()) != EOF)
    {
        if (c == ' ')
            if (pos % TAB != 0)
                nb++;
            else
                nb = 0, nt++;
        else
        {
            for (; nt > 0; nt--) // At least 2 circle, I can know here.
                putchar('\t');
            if (c == '\t')
                nb = 0;
            else
                for (; nb > 0; nb--)
                    putchar('*');
            putchar(c);
            if (c == '\n')
                pos = 0;
            else if (c == '\t')
                pos = pos + TAB - (pos - 1) % TAB - 1;
        }
        pos++;
    }
    return 0;
}